﻿<%--<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Models.TrainingsSchedules>" %>--%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.TrainingsSchedules>" %>
<%@ Import Namespace="CRM.Models" %>

<%
    var typesCol = new CRM.Database.Model.TrainingCoursesTypesCollection(); 
%>


<%--<%if (!(Model.IdTrainingsSchedule > 0))
  {%>--%>
<%
    Html.DevExpress().ComboBox(settings =>
                                   {
                                       settings.Name = "IdTrainingCoursesType";
                                       settings.CallbackRouteValues = new {Controller = "TC", Action = "TrainingsSchedulesEditCourseTypePartial"};
                                       settings.Properties.ValueType = typeof (int);
                                       settings.Properties.TextField = "NameRu";
                                       settings.Properties.ValueField = "IdTrainingCoursesType";
                                       settings.Width = 300;
                                       if (Model.IdTrainingsSchedule > 0)
                                           settings.ReadOnly = true;
                                       settings.Properties.EnableCallbackMode = true;
                                       if (!(Model.IdTrainingsSchedule > 0))
                                           settings.Properties.ClientSideEvents.BeginCallback = "function(s, e) { e.customArgs['Country'] = IdTrainingsCource.GetValue(); }";
                                   }).BindList(typesCol.GetTrainingsCoursesTypesByCourseId(Model.IdTrainingsCource)).Bind(Model.IdTrainingCoursesType).GetHtml();
    %>
    <%--}).BindList(DB.GetTrainingsCoursesTypesByCourseId(Model.IdTrainingsCource)).Bind(Model.IdTrainingCoursesType).GetHtml()%>--%>
<%--<%}%>

<%if (Model.IdTrainingsSchedule > 0)
  {%>
<%:Html.DevExpress().ComboBox(settings =>
    {
        settings.Name = "IdTrainingCoursesType";
        settings.CallbackRouteValues = new {Controller = "TC", Action = "TrainingsSchedulesEditCourseTypePartial"};
        settings.Properties.ValueType = typeof (int);
        settings.Properties.TextField = "NameRu";
        settings.Properties.ValueField = "IdTrainingCoursesType";
        settings.Width = 300;
        if (Model.IdTrainingsSchedule > 0)
            settings.ReadOnly = true;
        settings.Properties.EnableCallbackMode = true;
        //settings.Properties.ClientSideEvents.BeginCallback = "function(s, e) { e.customArgs['Country'] = IdTrainingsCource.GetValue(); }";
    }).Bind(Model.IdTrainingCoursesType).GetHtml()%>
<%}%>--%>